// import { fileURLToPath, URL } from 'node:url'
import { resolve } from 'path';

import { defineConfig } from 'vite';
import vue from '@vitejs/plugin-vue';

import AutoImport from 'unplugin-auto-import/vite';
import Components from 'unplugin-vue-components/vite';
//生产环境删除console
// import removeConsole from "vite-plugin-remove-console";
import { ElementPlusResolver } from 'unplugin-vue-components/resolvers';

// https://vitejs.dev/config/
export default defineConfig({

  publicPath: './',
  plugins: [
    vue(),
    AutoImport({
      resolvers: [ElementPlusResolver()],
    }),
    Components({
      resolvers: [ElementPlusResolver()],
    }),
  ],

  resolve: {
    alias: {
      '@': resolve(__dirname, './src'),
    },
    extensions: ['.ts', '.vue', '.js', '.jsx', '.tsx'], // 导入时想要省略的扩展名列表。
  },
  base: '/',
  server: {
    host: '0.0.0.0',
    port: 9092,
    open: true,
    cors: true,
    proxy: {
      '/cyr': {
        target: 'http://192.168.1.41:9092', //  目标地址
        // target: 'http://liechebao.cyrsum.com', //  目标地址
        // target:'http://47.109.89.106',
        changeOrigin: true,
      },
    },
  },
})
